import pymysql

# 1. 拨号连接
connection = pymysql.connect(host='localhost',
                             user='root',
                             password='123456',
                             database='hqyj',
                             port=3306,
                             charset='utf8')

cursor = connection.cursor()

cursor.execute(
'''
CREATE TABLE IF NOT EXISTS taobao_users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(20) NOT NULL UNIQUE,
    password VARCHAR(20) NOT NULL
);
'''
)

connection.commit()
print('创建成功')


cursor.close()
connection.close()